package com.wiloon.java8x.design.pattern.singleton;

class LazyLoadedSingleton {
	private static class LazyHolder {
		private static final LazyLoadedSingleton singletonInstatnce = new LazyLoadedSingleton();
	}

	public static LazyLoadedSingleton getInstance() {
		return LazyHolder.singletonInstatnce;
	}
}

class R1 implements Runnable {
	public void run() {
		System.out.println(LazyLoadedSingleton.getInstance().toString());
	}
}

public class Singleton2 {
	public static void main(String[] args) {

		R1 r = new R1();
		for (int i = 0; i <= 100; i++) {
			Thread t = new Thread(r);
			t.start();
		}
	}
}